UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ObMD7U7/h12HfxnMQiCM5twML6dbgQe5xIhCt5FA8lw=' 
WHERE 
  key_id = 'a89799046b6e4030c95050049dbce69509ff8bc3ff58b88d662e455d794c9d3d' 
  AND (
    token = 'ObMD7U7/h12HfxnMQiCM5twML6dbgQe5xIhCt5FA8lw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076