UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zQBMKh4JfOXrVfJdpo9T8+aPRMKi3zk48sXZ0P754o4='
WHERE
key_id = 'd981ad78f74f88b2920fa27aaab09643ccd35e5ec2b01874afb460f244aea8f8'
AND (
token = 'zQBMKh4JfOXrVfJdpo9T8+aPRMKi3zk48sXZ0P754o4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)