UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YXt1VhxqYpO9Y3Z5gVU5C32CxJx/kCjBhn9+MLgK1X0='
WHERE
key_id = '4cb52b7afe18055b1242e0efdbe2778d5c42f65f2a4bda9d9087f6570db33350'
AND (
token = 'YXt1VhxqYpO9Y3Z5gVU5C32CxJx/kCjBhn9+MLgK1X0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)