UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y866uTMUlRq3RhfSgjZZ7KUVTwMPhKDDP2qaJcacHM0=' 
WHERE 
  key_id = '356f277531e61ba03b0f858338d16620cbc3ba4d0a39968c2a4157fdad087de9' 
  AND (
    token = 'Y866uTMUlRq3RhfSgjZZ7KUVTwMPhKDDP2qaJcacHM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033