UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xE16HpLvXeFbSrMtmyT6yZO9CWBkllU7skbUwEEtx8M='
WHERE
key_id = '4f0ad0f6eb7639350f8e55f10785152575d2e61ed759c5093c3de7d9412da799'
AND (
token = 'xE16HpLvXeFbSrMtmyT6yZO9CWBkllU7skbUwEEtx8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)