UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4qRingJnJtmee8pw94WYpPKvsNT5NaDJo+g623XXXwY='
WHERE
key_id = '712548a814e7e34f93d1a1568ddb27244e38d32d99239236e05fa03ad7c32c0a'
AND (
token = '4qRingJnJtmee8pw94WYpPKvsNT5NaDJo+g623XXXwY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)