UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sr7QHlINUDZUuGZa4QcwHBtcl62yz+H1edpJVXyTU2M=' 
WHERE 
  key_id = '3ea84c605ff943d4d078e8b8867ce09316a6376cbd8b60771e4ac6d65a1a4bd5' 
  AND (
    token = 'Sr7QHlINUDZUuGZa4QcwHBtcl62yz+H1edpJVXyTU2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029