UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aPis1+HXHQj2I1RUlqAGwMGK69bF/yZdhwTUCURic34='
WHERE
key_id = '737c1c3414f00c041a17f6bf636b9d2460c294d3db34fcaaa8031f37b0df4706'
AND (
token = 'aPis1+HXHQj2I1RUlqAGwMGK69bF/yZdhwTUCURic34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)