UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SzR2TwtzfQd0rrJ1QWMsdbsE4K8rR1DyN5zp27TI4uY='
WHERE
key_id = 'c82a4eab29b785bd8200e7f17e4a98c6e82e442303308dd232fa712766359626'
AND (
token = 'SzR2TwtzfQd0rrJ1QWMsdbsE4K8rR1DyN5zp27TI4uY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)