UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HOxUJb1O0Hg7ZhsxU8aXdu7oBcguUtzvkx5xTXD6ZXQ='
WHERE
key_id = '31aff5c1903882e3dd026c17df27a5779a9cde3e0c89adc9c1ffd70a03a7a8f4'
AND (
token = 'HOxUJb1O0Hg7ZhsxU8aXdu7oBcguUtzvkx5xTXD6ZXQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)