UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NcWBxys3004gjfRyK2Xd/ojaomDQpUHh8IMWTris3z4='
WHERE
key_id = 'd63099ccfd9488f822db109574064d87d75729b01bbb18963a49157a8c02a671'
AND (
token = 'NcWBxys3004gjfRyK2Xd/ojaomDQpUHh8IMWTris3z4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)