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