UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gCZCyypdVKvSJX2r/A2vuCjGFTcWKwaKwTDq+/joBy4='
WHERE
key_id = '3f4e3e4dd01276c2f66dab55034ec5c79988392b2992f5bf9b7e57a8b5ebf5ae'
AND (
token = 'gCZCyypdVKvSJX2r/A2vuCjGFTcWKwaKwTDq+/joBy4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)