UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZGI4OvhymUSMulr8Ym6vrST9Gf6Cq0LK+fyscvs7hJs='
WHERE
key_id = 'b8a3da0eb1c0275901a554f32d2569c58cea309bed77f4f67d3a79871898021b'
AND (
token = 'ZGI4OvhymUSMulr8Ym6vrST9Gf6Cq0LK+fyscvs7hJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)