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

Query time 0.00022