UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'keANJR4HJtZUcfr97a81hp9+uRa3uBJnTf0nht47OnY=' 
WHERE 
  key_id = '1e52cfd33518b8ec0b1fc2fb7bcd54f79534976f330758dda39f314b77e730fd' 
  AND (
    token = 'keANJR4HJtZUcfr97a81hp9+uRa3uBJnTf0nht47OnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030