UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VoTNlW7tRwfhbycFtejT3+/j3T3sShLyYIGWSHvfbTA=' 
WHERE 
  key_id = 'e21b89b903e1ff58627099239b3c812b08e331807045c03083aa5541efffc198' 
  AND (
    token = 'VoTNlW7tRwfhbycFtejT3+/j3T3sShLyYIGWSHvfbTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038