UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r0mL03thdWigWQ365as6z51rrsjXpEA69DOdkVg0jmU='
WHERE
key_id = '852758c5bb36139558089746d5c5ed3d47f15559ca571aefe32041cdcfa9503f'
AND (
token = 'r0mL03thdWigWQ365as6z51rrsjXpEA69DOdkVg0jmU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)