UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6I7yvB3OPev4n25/u5L0NCcfM1Q4QU6lgUHqbIOZnn4='
WHERE
key_id = '364e8b112319de3c68567a6250ce10dbfa2ec1fe6848c43003225e03a35b9a90'
AND (
token = '6I7yvB3OPev4n25/u5L0NCcfM1Q4QU6lgUHqbIOZnn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)