UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8HKxcUDVqOw768/rkN8QfgH95XSTnAjNzh7PZVhcHSw='
WHERE
key_id = '8e39fdc1d34e428f6bf645753d8545e907cba6f8237ec2214707b476b4ee3bbd'
AND (
token = '8HKxcUDVqOw768/rkN8QfgH95XSTnAjNzh7PZVhcHSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)