UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tX6gup/um9Iv94zh3uYN3PhEaADyqMmpMM3VjscmG/E='
WHERE
key_id = 'd1e9b2e1191164d3623ad80db62291ca35d3c7f0c991a9ffca0b806a285653c0'
AND (
token = 'tX6gup/um9Iv94zh3uYN3PhEaADyqMmpMM3VjscmG/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)