UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '254fq9roPX9O+Cljlfq5lXAZtH0UbwpoXGcahsslUY0='
WHERE
key_id = 'd63f12756356d937e42bb1e2a1b1dd0efa5445895107706276a263b56e5b7577'
AND (
token = '254fq9roPX9O+Cljlfq5lXAZtH0UbwpoXGcahsslUY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)