UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ckQYuvcFhxAXgYP4eAYcm6N21M5emsZhLsyclYqFZpU='
WHERE
key_id = '54350378d549b3c8a5a7873c2c55f3cc03065d0173c4934d4c4e7e21ccd0aed4'
AND (
token = 'ckQYuvcFhxAXgYP4eAYcm6N21M5emsZhLsyclYqFZpU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)