UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B/ORRGH24AUOScTwi5/doUzlmGrk1V4UDhqrTScpKfo=' 
WHERE 
  key_id = 'ee2c033edaed61dcab0f89edc243310d971f6221075bfb0b237f42e4a9cc8f12' 
  AND (
    token = 'B/ORRGH24AUOScTwi5/doUzlmGrk1V4UDhqrTScpKfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029