UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'knIgSTGUODKiNC3XUKAc+dVhjCV0uH4SIML5MUxSwGY='
WHERE
key_id = 'e5f2e56ed9d3ffc42a3e91f2159b0e60be71f78c40f14af7a55f9ef68d91acd1'
AND (
token = 'knIgSTGUODKiNC3XUKAc+dVhjCV0uH4SIML5MUxSwGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)