UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4rimdhm6UfI35e8xkYZsU6gt+6dl3F1KrRHnWOOwg0w='
WHERE
key_id = '6f3ebfd8730c5bf8e3881a8d295d0d96d4c2e0527089ed188139102c120cd26a'
AND (
token = '4rimdhm6UfI35e8xkYZsU6gt+6dl3F1KrRHnWOOwg0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)