UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rghiUnSFXYw21teWT0UhfEKmzVoae1kgsgc7G5+84rs=' 
WHERE 
  key_id = '26e94208f08a7b109c1a845c428819e5633c62aa795f471f252f7f63915ec35a' 
  AND (
    token = 'rghiUnSFXYw21teWT0UhfEKmzVoae1kgsgc7G5+84rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021