UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TApCVdTY0nftTccKk1vVfQoP5OaQydbA2BGAzkKayZE='
WHERE
key_id = '8f5c3fc55e048316790a9deded50ccd9c3d86985ea8e733b12966e871c949c6e'
AND (
token = 'TApCVdTY0nftTccKk1vVfQoP5OaQydbA2BGAzkKayZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)