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