UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ApJzqX+U90r+7I9ggQQpzz10DMg0T48rY97xr0Bu7Ko='
WHERE
key_id = 'b4ca216a79cb153b28a1a55022c7154e4efdaf61965e10d91feb8930fb0f49c0'
AND (
token = 'ApJzqX+U90r+7I9ggQQpzz10DMg0T48rY97xr0Bu7Ko='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)