UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1ktD0Vh88TniJOw5TVRky0Y8IdS0o3O18dM3o6Yq0m4='
WHERE
key_id = 'c8836923b4e04fe0f59fd61b8c687e654b1201a313ecf74d122615ab484a4fdb'
AND (
token = '1ktD0Vh88TniJOw5TVRky0Y8IdS0o3O18dM3o6Yq0m4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)