UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hv0EwUkfSrRMUh0g3GfwczAWsePAwPRwyR/1+5TtV84=' 
WHERE 
  key_id = '1cadb0a5458c9d9b3813edb21c4a9945febe2eb1c349cf90ec8d4ea5ad9d000a' 
  AND (
    token = 'hv0EwUkfSrRMUh0g3GfwczAWsePAwPRwyR/1+5TtV84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022