UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gleb3re+VYAMiHuRyny9SMuwT8XqvPUJGtcEjJkkGm8=' 
WHERE 
  key_id = '34081c4744e766c6864fa3e0239cca40757f9d836bdc0f55eabb040d76eb1303' 
  AND (
    token = 'Gleb3re+VYAMiHuRyny9SMuwT8XqvPUJGtcEjJkkGm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040