UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '71ry+w3I5HH3Ka96kF4RVD3xS1rLboG6fNCkWcUOw+w='
WHERE
key_id = 'b96ada214be4ae0b1b19d5d643089cd697ed9eb0690b7c9135b742a77691eff0'
AND (
token = '71ry+w3I5HH3Ka96kF4RVD3xS1rLboG6fNCkWcUOw+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)