UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CNLWX3rg3DIQg8JaIJ8nSiqCto29vcX85abVxnGSvks=' 
WHERE 
  key_id = 'd4d4afdfdd7206d17a03241f90d64e34d4be19d213731c52c00282cdeedbe47a' 
  AND (
    token = 'CNLWX3rg3DIQg8JaIJ8nSiqCto29vcX85abVxnGSvks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057