UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VPMlrSUAQ8qFguXfgE5UWIA0hZ2sWlGxnSm5u8royG8=' 
WHERE 
  key_id = 'e521002e1de140b136f7e914eec99deb9c685ff04c5de2288fc7367a6ee04858' 
  AND (
    token = 'VPMlrSUAQ8qFguXfgE5UWIA0hZ2sWlGxnSm5u8royG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021