UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QNRWheksqA0j7pOP7auss8Xfa3KmB0vv1QaN+NyfSp0='
WHERE
key_id = 'ad964a898a4b784d963d10e0ba5a35cd77c13beebffb2c4f65e4f9ee498c2326'
AND (
token = 'QNRWheksqA0j7pOP7auss8Xfa3KmB0vv1QaN+NyfSp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)