UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ElYPyrekpkMZBG2HA97VRobfWghCbzPKTT0lMF6wd+Q=' 
WHERE 
  key_id = '3813ca6e681633b423b5509617f5fbb279ac62dee4c06312a75a10b68a20c641' 
  AND (
    token = 'ElYPyrekpkMZBG2HA97VRobfWghCbzPKTT0lMF6wd+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036