UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cd0CHrpV9WnHNad8rlGIeedGxtOiU9epv/KPsdwZMEo=' 
WHERE 
  key_id = '941dfd523c88d05b8b79b6fe815698fe222f551c6f7b8dde603b6282994abbaa' 
  AND (
    token = 'cd0CHrpV9WnHNad8rlGIeedGxtOiU9epv/KPsdwZMEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028