UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e3Qq7ODXPyV4g8Fq4ZtA2GhkMp7FvnY4lOyy5vokl+s=' 
WHERE 
  key_id = '8170c748b552b0feb476ce687d96d6c325ccdbc3940272164d697ba7400fb50b' 
  AND (
    token = 'e3Qq7ODXPyV4g8Fq4ZtA2GhkMp7FvnY4lOyy5vokl+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025