UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qK4kD+CD/duHATalsByp0m45rMn9PFaahYLjcrK6i+w='
WHERE
key_id = '128cf4c537a8fe61951d4ae2acdd5422949d105e37b4f58530c546a0200e87bb'
AND (
token = 'qK4kD+CD/duHATalsByp0m45rMn9PFaahYLjcrK6i+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)