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

Query time 0.00037