UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pGdGB8c5iDX61kavtszVrXoY/m0FQ0wYRhYsLCOmPys='
WHERE
key_id = 'a45ba08b72d0c7b5ce5ea70d4d6f9743caee330a6b897049357d2efefaa476af'
AND (
token = 'pGdGB8c5iDX61kavtszVrXoY/m0FQ0wYRhYsLCOmPys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)