UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gd9Djz7LpGkShmAn81dqskBWRbZcnQseGBCLv7P4hFA=' 
WHERE 
  key_id = '9781b7778d47d471b407f159bc73b124b07f952cbf5b4097368edfc5433647b5' 
  AND (
    token = 'Gd9Djz7LpGkShmAn81dqskBWRbZcnQseGBCLv7P4hFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045